package com.soul.common.feign;

import com.soul.common.bean.vo.FileVo;
import com.soul.common.msg.ApiResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author Shiws
 * @version 1.0
 * @date 2023/11/21 16:13
 */
@FeignClient(contextId = "CommDocService", value = "soul-doc")
public interface CommDocService {

    @PostMapping("/file/query/ids")
    ApiResult<List<FileVo>> queryFileVoByIds_(@RequestBody Collection<Long> ids);

    default List<FileVo> queryFileVoByIds(@RequestBody Collection<Long> ids){
        ApiResult<List<FileVo>> apiResult = this.queryFileVoByIds_(ids);
        if (apiResult.getStatus() == 200){
            return apiResult.getData();
        }
        return new ArrayList<>();
    }
}
